//
//  RadioDetailsCell.m
//  PetTown
//
//  Created by lanou3g on 15/5/31.
//  Copyright (c) 2015年 lanou3g. All rights reserved.
//

#import "RadioDetailsCell.h"
#define LHeight self.contentView.frame.size.height
#define LWidth  self.contentView.frame.size.width
@implementation RadioDetailsCell
- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setUpSubViews];//添加视图
        
    }
    return self;
}
//添加视图
- (void)setUpSubViews{
    //左侧img
    self.contentView.frame = CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y, [UIScreen mainScreen].bounds.size.width, self.contentView.frame.size.height);
    
    self.leftImg = [[UIImageView alloc] init];
    self.leftImg.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:_leftImg];
    //标题
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.alpha = 0.7;
    self.titleLabel.font = [UIFont systemFontOfSize:14];
    [self.contentView addSubview:_titleLabel];
    //听众数
    self.musicVisitLabel = [[UILabel alloc] init];
    _musicVisitLabel.font = [UIFont systemFontOfSize:14.0];
    _musicVisitLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:_musicVisitLabel];
    //右侧图片
    self.rightImg = [[UIImageView alloc] init];
    [self.contentView addSubview:_rightImg];
}

//设置显示内容
-(void)setRadioDetails:(RadioDetails *)radioDetails{
    _titleLabel.text = radioDetails.title;
    _musicVisitLabel.text = [NSString stringWithFormat:@"♡ %@",radioDetails.musicVisit];
    _rightImg.image = [UIImage imageNamed:@"PauseRadio.png"];
    _rightImg.alpha = 0.7;
    //设置frame
    _leftImg.frame = CGRectMake(20, 10, 60, 60);
    _titleLabel.frame = CGRectMake(CGRectGetMaxX(_leftImg.frame)+5, 10, LWidth - 95, 30);
    _musicVisitLabel.frame = CGRectMake(CGRectGetMaxX(_leftImg.frame)+5, CGRectGetMaxY(_titleLabel.frame)+10, LWidth - 95, 20);
    _rightImg.frame = CGRectMake(LWidth - 50, 30, 20, 20);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
